package com.ryan.sso.client.two;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by kaimin on 20/1/2019.
 * time : 23:17
 */
@RestController
@SpringBootApplication
@EnableOAuth2Sso//加上单点登录的注解，但生效还是要加配置
public class Client2AppRun {

    public static void main(String[] args) {
        SpringApplication.run(Client2AppRun.class,args);
    }

    /**
     * 可以拿到用户信息
     * @param user
     * @return
     */
    @GetMapping("/user")
    public Authentication getUser(Authentication user){
        return user;
    }
}
